/*
 * @Copyright: 2016 www.yyfax.com Inc. All rights reserved.
 */
package com.jaws.core.compatible.exception;

import org.apache.commons.lang3.StringUtils;

import com.jaws.core.mvc.exception.RspCodeEnum;

/**
 * 自定义运行时异常
 * 
 * @author jiangmy
 * @date 2016-12-08 13:07:19
 */
@SuppressWarnings("serial")
public class YYRuntimeException extends RuntimeException {

	protected int code;
	protected String message;
	protected String display;

	/**
	 * 构造函数
	 */
	public YYRuntimeException() {
		super();
	}

	public YYRuntimeException(RspCodeEnum code) {
		this(code, "");
	}

	public YYRuntimeException(RspCodeEnum code, String message) {
		super();
		this.code = Integer.valueOf(code.getValue());
		this.display = code.getDisplay();
		this.message = message;
	}

	public YYRuntimeException(RspCodeEnum code, String display, String message) {
		super();
		this.code = Integer.valueOf(code.getValue());
		this.display = StringUtils.isBlank(display) ? code.getDisplay() : display;
		this.message = message;
	}

	public YYRuntimeException(int code) {
		super();
		this.code = code;
	}

	public YYRuntimeException(int code, String message) {
		super();
		this.code = code;
		this.message = message;
	}

	public YYRuntimeException(int code, String message, String display) {
		super();
		this.code = code;
		this.message = message;
		this.display = display;
	}

	/**
	 * 构造函数
	 * 
	 * @param message
	 * @param cause
	 * @param enableSuppression
	 * @param writableStackTrace
	 */
	public YYRuntimeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
		super(message, cause, enableSuppression, writableStackTrace);
	}

	/**
	 * 构造函数
	 * 
	 * @param message
	 * @param cause
	 */
	public YYRuntimeException(String message, Throwable cause) {
		super(message, cause);
	}

	/**
	 * 构造函数
	 * 
	 * @param message
	 */
	public YYRuntimeException(String message) {
		super(message);
	}

	/**
	 * 构造函数
	 * 
	 * @param cause
	 */
	public YYRuntimeException(Throwable cause) {
		super(cause);
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getDisplay() {
		return display;
	}

	public void setDisplay(String display) {
		this.display = display;
	}

}
